home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows4 / pcproj.zip / ACTIVDIA.CLS next >
Text File  |  1989-12-02  |  2KB  |  68 lines

  1. /* This is a formal class to define common behavior between
  2.    the various dialog boxes in the project application. 
  3.    Descendants should define the res() method to return the
  4.    resource ID to be used, initDialog() to initialize values
  5.    and update() to update values.
  6.  
  7.    ActivDialog descends from class Dialog and inherits all of its
  8.    methods and instance variables.
  9. */!!
  10.  
  11. inherit(Dialog, #ActivDialog, #(activity  /* what is being edited */), 2, nil)!!
  12.  
  13. now(ActivDialogClass)!!
  14.  
  15. now(ActivDialog)!!
  16.  
  17. /* Set the object being edited. */
  18. Def  setEditItem(self, anEditItem)
  19. {
  20.   activity := anEditItem;
  21. }!!
  22.  
  23. /* Run the dialog with the appropriate resource. 
  24.    Display a warning if the run fails. */
  25. Def  run(self, parent | retValue)
  26. {
  27.   ^checkRunModal(self, res(self), parent);
  28. }!!
  29.  
  30. /* Initialize all of the fields in the dialog. */
  31. Def  initDialog(self, wp, lp)
  32. {
  33.   setText(self, makeCaption(activity));
  34.   
  35.   setItemText(self, NAME, getName(activity));
  36.   setItemText(self, DESC, getDesc(activity));
  37.   setItemText(self, UES, checkString(getUserEarlyStart(activity)));
  38.   setItemText(self, ULF, checkString(getUserLateFinish(activity)));
  39.  
  40.   /* these are non-editable */
  41.   setItemText(self, ES, asString(getEarlyStart(activity)));
  42.   setItemText(self, EF, asString(getEarlyFinish(activity)));
  43.   setItemText(self, LS, asString(getLateStart(activity)));
  44.   setItemText(self, LF, asString(getLateFinish(activity)));
  45.   setItemText(self, SLACK, asString(getSlack(activity)));
  46. }!!
  47.  
  48. /* Handle the Ok and Cancel buttons.  If Ok was 
  49.    pressed, then update the item.  This command
  50.    method is used by descendants.  They will define
  51.    their own update method.  */
  52. Def command(self, wp, lp)
  53. {
  54.   select
  55.     case wp == IDOK
  56.        update(self);
  57.        end(self, IDOK);
  58.     endCase
  59.     case wp == IDCANCEL            
  60.        end(self, IDCANCEL); 
  61.     endCase
  62.     default 
  63.       ^1;
  64.   endSelect;
  65.   ^0;
  66. } !!
  67.  
  68.